<template>
    <div class="log">
        <Search v-model="mSearch.data.name" placeholder="请输入菜单名" @search="mSearch.onSearch()" :clearable="false" />
        <div class="bottomborder"></div>
        <bSearch :instance="mSearch"></bSearch>
        <bList :instance="pList" @about="onRoutertoInfo">
        </bList>
    </div>
</template>
<script setup lang="ts">
import bList from "@m/components/public/b_list.vue";
import bSearch from "@m/components/public/b_search.vue";
import { Search } from "vant";
import { Menulist, MenuSearch } from '@b/index/menu'
import { pagebuttonStore } from "@b/store";
import { useRouter } from "vue-router";
const router = useRouter()
const mSearch = new MenuSearch()
const pList = new Menulist()
const but = pagebuttonStore().button
pList.labels.icon!.show = () => false
mSearch.init()
mSearch.onSearch = () => {
    pList.search_key = mSearch.getData()
    pList.refresh(1)
    mSearch.show = false
}
const onRoutertoInfo = (data: interfaceMenu) => {
    if (but.has('editMenu'))
        router.push('editMenu?id=' + data.id)
}
</script>

<style scoped>
.log :deep(.van-cell) {
    justify-content: space-between;
}

.log :deep(.van-cell__title) {
    flex-grow: 0;
    white-space: nowrap;
}

.left-button {
    color: var(--van-danger-color)
}
</style>